<?php
include ("functions.php");

header('Content-Type: text/javascript');
header('Cache-Control: no-cache');
header('Pragma: no-cache');

if (!$link = connect()){
	die ("Error en la conexión con la base de datos");
}

$sql = "SELECT * FROM gb_entries;";
$resul = mysql_db_query('guestbook', $sql, $link);

$cadena = "[";
while ($row = mysql_fetch_array($resul)){
	$cadena .= "{'name': '".$row["name"]."','lastName': '".$row["lastName"];
	$cadena .= "', 'gender': '".$row["gender"]."', 'country': '".$row["country"]."', 'comment': '".$row["comment"];
	$cadena .= "', 'date': '".$row["date"]."'},";	
}
$cadena .= "]";

echo $cadena;

disconnect($link);
?>